import request from "@/utils/request";
const qs = require("qs");
//获取登陆用户信息
export function getLoginUserInfo(params) {
  return request({
    url: "/auth/loginUserInfo",
    method: "get"
  });
}
//获取应用列表
export function getAppList(params) {
  return request({
    url: "/admin/app/list",
    method: "get",
    params: params
  });
}
//更改停用/启用状态
export function changeAppStatus(params) {
  return request({
    url: "/admin/app/changeStatus",
    method: "post",
    data: qs.stringify(params)
  });
}
//删除应用
export function deleteApp(params) {
  return request({
    url: "/admin/app/delete",
    method: "post",
    data: qs.stringify(params)
  });
}
//新增或更新应用
export function saveOrUpdateApp(params) {
  return request({
    url: "/admin/app/saveOrUpdate",
    method: "post",
    data: qs.stringify(params)
  });
}
//获取应用详情
export function appDetail(id) {
  return request({
    url: "/admin/app/" + id,
    method: "get"
  });
}

//获取所有学校列表
export function schoolList(params) {
  return request({
    url: "/admin/office/school/list",
    method: "get",
    params: params
  });
}
// 获取连锁学校信息（包括子学校）
export function chainSchoolList(params) {
  return request({
    url: "/admin/office/chainSchoolList",
    method: "get",
    params: params
  });
}
//获取所有学校和部门列表(数据范围权限控制)
export function officeList(params) {
  return request({
    url: "/admin/office/list",
    method: "get",
    params: params
  });
}
//获取所有学校和部门列表(没有数据范围权限的也返回，通过access字段进行控制)
export function officeAccessList(params) {
  return request({
    url: "/admin/office/listAccess",
    method: "get",
    params: params
  });
}
//获取一个学校所有组织机构数据（包括子学校）
export function oneSchoolOfficeList(params) {
  return request({
    url: "/admin/office/oneSchoolList",
    method: "get",
    params: params
  });
}
//获取所有学校和部门列表
export function changeOfficeStatus(params) {
  return request({
    url: "/admin/office/changeStatus",
    method: "post",
    data: qs.stringify(params)
  });
}
//获取机构详情
export function officeDetail(id, parentDetail, schoolDetail) {
  let url = "/admin/office/" + id;
  let params = {
    parentDetail: !!parentDetail,
    schoolDetail: !!schoolDetail
  };
  return request({
    url: url,
    method: "get",
    params: params
  });
}
//获取机构详情
export function deleteOffice(id) {
  return request({
    url: "/admin/office/delete?id=" + id,
    method: "get"
  });
}
//新增机构（部门）
export function saveOffice(params) {
  return request({
    url: "/admin/office/save",
    method: "post",
    data: qs.stringify(params)
  });
}
//更新机构（部门）
export function updateOffice(params) {
  return request({
    url: "/admin/office/update",
    method: "post",
    data: qs.stringify(params)
  });
}
//更新机构(部门或学校，只有超级管理员有权限)
export function saveOrUpdateOffice(params) {
  return request({
    url: "/admin/office/saveOrUpdate",
    method: "post",
    data: qs.stringify(params)
  });
}
//分配角色
export function supplyRole(params) {
  return request({
    url: "/admin/office/supplyRole",
    method: "post",
    data: qs.stringify(params)
  });
}
//获取分配角色列表
export function supplyRoleList(params) {
  return request({
    url: "/admin/office/supplyRoleList",
    method: "get",
    params: params
  });
}

//更新角色数据权限范围
export function updateRoleOfficeScope(params) {
  return request({
    url: "/admin/roleOfficeScope/update",
    method: "post",
    data: qs.stringify(params)
  });
}

//获取学校 应用列表
export function schoolAppList(params) {
  return request({
    url: "/admin/school-app/list",
    method: "get",
    params: params
  });
}
//更新学校 应用信息
export function updateSchoolApps(params) {
  return request({
    url: "/admin/school-app/update",
    method: "post",
    data: qs.stringify(params)
  });
}

//获取应用菜单权限列表
export function menuPermissionList(params) {
  return request({
    url: "/admin/menu/app/list",
    method: "get",
    params: params
  });
}
//获取菜单权限详情
export function menuPermissionDetail(id, parentDetail) {
  let url = "/admin/menu/" + id;
  if (parentDetail) {
    url += "?parentDetail=true";
  }
  return request({
    url: url,
    method: "get"
  });
}
//新增或更新菜单权限详情
export function saveOrUpdateMenuPermission(params) {
  return request({
    url: "/admin/menu/saveOrUpdate",
    method: "post",
    data: qs.stringify(params)
  });
}
//新增或更新菜单权限详情
export function deleteMenuPermission(params) {
  return request({
    url: "/admin/menu/delete",
    method: "post",
    data: qs.stringify(params)
  });
}
//停用 启用菜单
export function changeMenuPermStatus(params) {
  return request({
    url: "/admin/menu/changeStatus",
    method: "post",
    data: qs.stringify(params)
  });
}

//获取角色列表
export function roleList(params) {
  return request({
    url: "/admin/role/list",
    method: "get",
    params: params
  });
}
//获取一个学校的角色列表
export function schoolRoleList(params) {
  return request({
    url: "/admin/role/schoolRoleList",
    method: "get",
    params: params
  });
}
//获取所有角色列表
export function roleListAll(params) {
  return request({
    url: "/admin/role/listAll",
    method: "get",
    params: params
  });
}
//获取所有状态正常的角色列表
export function listAllNormal(params) {
  return request({
    url: "/admin/role/listAllNormal",
    method: "get",
    params: params
  });
}
//获取所有对外开放的角色列表
export function listOpenAll(params) {
  return request({
    url: "/admin/role/listOpenAll",
    method: "get",
    params: params
  });
}
//获取用户权限范围内角色列表
export function scopeRoleList(params) {
  return request({
    url: "/admin/role/scopeList",
    method: "get",
    params: params
  });
}
//更新用户角色
export function userRoleUpdate(params) {
  return request({
    url: "/admin/userRoleDetail/update",
    method: "post",
    data: qs.stringify(params)
  });
}
//删除角色
export function deleteRole(params) {
  return request({
    url: "/admin/role/delete",
    method: "post",
    params: params
  });
}
//角色 启用停用
export function roleChangeStatus(params) {
  return request({
    url: "/admin/role/changeStatus",
    method: "post",
    params: params
  });
}
//角色 详情
export function roleDetail(id, menuPermission, dataScope, registerRequ) {
  let params = {
    menuPermission: !!menuPermission,
    dataScope: !!dataScope,
    registerRequ: !!registerRequ
  };
  return request({
    url: "/admin/role/" + id,
    method: "get",
    params: params
  });
}
//角色 新增或更新
export function saveOrUpdateRole(params) {
  return request({
    url: "/admin/role/saveOrUpdate",
    method: "post",
    data: qs.stringify(params)
  });
}
//角色 新增
export function saveRole(params) {
  return request({
    url: "/admin/role/save",
    method: "post",
    data: qs.stringify(params)
  });
}
//角色 更新
export function updateRole(params) {
  return request({
    url: "/admin/role/update",
    method: "post",
    data: qs.stringify(params)
  });
}
//角色 数据范围权限
export function roleScopePerm(params) {
  return request({
    url: "/admin/role/scopePerm",
    method: "get",
    params: params
  });
}
//角色 菜单权限
export function roleMenuPerm(params) {
  return request({
    url: "/admin/role/menuPerm",
    method: "get",
    params: params
  });
}
//获取学校应用菜单列表
export function schoolAppMenuList(params) {
  return request({
    url: "/admin/menu/schoolAppMenuList",
    method: "get",
    params: params
  });
}
//获取学校应用菜单列表
export function updateRoleMenu(params) {
  return request({
    url: "/admin/role-menu/update",
    method: "post",
    data: qs.stringify(params)
  });
}

//获取机构用户列表 包括子机构(有范围权限控制)
export function officeUserScopeList(params) {
  return request({
    url: "/admin/officeUserDetail/scopeList",
    method: "get",
    params: params
  });
}
//获取学校用户列表
export function schoolUserList(params) {
  return request({
    url: "/admin/officeUserDetail/schoolUserList",
    method: "get",
    params: params
  });
}
//获取学校选入用户列表
export function checkInSchoolUserList(params) {
  return request({
    url: "/admin/officeUserDetail/checkInSchoolUserList",
    method: "get",
    params: params
  });
}
//新增或更新学校用户信息
export function saveOrUpdateSchoolUser(params) {
  return request({
    url: "/admin/officeUserDetail/saveOrUpdateSchoolUser",
    method: "post",
    data: qs.stringify(params)
  });
}

//新增学校用户信息
export function saveSchoolUser(params) {
  return request({
    url: "/admin/officeUserDetail/saveSchoolUser",
    method: "post",
    data: qs.stringify(params)
  });
}

//更新学校用户信息
export function updateSchoolUser(params) {
  return request({
    url: "/admin/officeUserDetail/updateSchoolUser",
    method: "post",
    data: qs.stringify(params)
  });
}

//更改学校用户状态
export function changeSchoolUserStatus(params) {
  return request({
    url: "/admin/officeUserDetail/changeUserStatus",
    method: "post",
    data: qs.stringify(params)
  });
}
//删除学校用户
export function deleteSchoolUser(params) {
  return request({
    url: "/admin/officeUserDetail/deleteUser",
    method: "post",
    data: qs.stringify(params)
  });
}
//重置学校用户密码
export function resetSchoolUserPwd(params) {
  return request({
    url: "/admin/officeUserDetail/resetPwd",
    method: "post",
    data: qs.stringify(params)
  });
}
//获取学校用户详情
export function schoolUserDetail(params) {
  return request({
    url: "/admin/officeUserDetail/userDetail",
    method: "post",
    data: qs.stringify(params)
  });
}

//获取机构用户列表 包括子机构
export function deleteOfficeUser(params) {
  return request({
    url: "/admin/officeUserDetail/delete",
    method: "post",
    data: qs.stringify(params)
  });
}

//获取用户详情
export function userDetail(params) {
  return request({
    url: "/admin/user/" + params.id,
    method: "get",
    params: params
  });
}
//获取用户详情
export function officeUserDetail(params) {
  return request({
    url: "/admin/user/officeUser/" + params.id,
    method: "get",
    params: params
  });
}
//获取用户列表
export function userList(params) {
  return request({
    url: "/admin/user/list",
    method: "get",
    params: params
  });
}
//更改用户状态
export function changeUserStatus(params) {
  return request({
    url: "/admin/user/changeStatus",
    method: "post",
    data: qs.stringify(params)
  });
}
//删除用户
export function deleteUser(params) {
  return request({
    url: "/admin/user/delete",
    method: "post",
    data: qs.stringify(params)
  });
}
//新增或更新用户
export function saveOrUpdateUser(params) {
  return request({
    url: "/admin/user/saveOrUpdate",
    method: "post",
    data: qs.stringify(params)
  });
}
//一个机构的用户集合
export function oneOfficeUserList(params) {
  return request({
    url: "/admin/officeUserDetail/oneOfficeList",
    method: "get",
    params: params
  });
}
//一个学校的用户集合
export function oneSchoolUserList(params) {
  return request({
    url: "/admin/officeUserDetail/oneSchoolUserList",
    method: "get",
    params: params
  });
}
//机构用户添加
export function officeUserAdd(params) {
  return request({
    url: "/admin/officeUserDetail/save",
    method: "post",
    data: qs.stringify(params)
  });
}

//应用参数配置分页信息
export function paramConfigList(params) {
  return request({
    url: "/admin/schoolAppConfig/list",
    method: "get",
    params: params
  });
}
//新增或更新应用参数配置
export function saveOrUpdateParamConfig(params) {
  return request({
    url: "/admin/schoolAppConfig/saveOrUpdate",
    method: "post",
    data: qs.stringify(params)
  });
}
//删除应用参数配置
export function deleteParamConfig(params) {
  return request({
    url: "/admin/schoolAppConfig/delete",
    method: "post",
    data: qs.stringify(params)
  });
}
//更改 应用参数配置 停用启用状态
export function paramConfigChangeStatus(params) {
  return request({
    url: "/admin/schoolAppConfig/changeStatus",
    method: "post",
    data: qs.stringify(params)
  });
}
//应用参数配置 详情
export function paramConfigDetail(params) {
  return request({
    url: "/admin/schoolAppConfig/" + params.id,
    method: "get"
  });
}

//更新角色注册资料输入配置信息
export function updateRoleRegisterRequ(params) {
  return request({
    url: "/admin/roleRegisterRequ/update",
    method: "post",
    data: qs.stringify(params)
  });
}

//获取注册申请列表数据
export function registerApplyList(params) {
  return request({
    url: "/admin/roleRegisterApply/list",
    method: "get",
    params: params
  });
}
//获取注册申请详情
export function registerApplyDetal(params) {
  return request({
    url: "/admin/roleRegisterApply/" + params.id,
    method: "get"
  });
}
//注册申请审核操作
export function registerApplyAudit(params) {
  return request({
    url: "/admin/roleRegisterApply/audit",
    method: "post",
    data: qs.stringify(params)
  });
}
//注册申请删除
export function registerApplyDelete(params) {
  return request({
    url: "/admin/roleRegisterApply/delete",
    method: "post",
    data: qs.stringify(params)
  });
}
//注册申请 停用启用
export function registerApplyChangeStatus(params) {
  return request({
    url: "/admin/roleRegisterApply/changeStatus",
    method: "post",
    data: qs.stringify(params)
  });
}

//获取学校应用分页信息
export function schoolAppPageList(params) {
  return request({
    url: "/admin/school-app/pageList",
    method: "get",
    params: params
  });
}

//获取学校应用分页信息
export function schoolAppChangeStatus(params) {
  return request({
    url: "/admin/school-app/changeStatus",
    method: "post",
    data: qs.stringify(params)
  });
}

//判断角色下面是否有用户
export function roleHasUsers(params) {
  return request({
    url: "/admin/role/roleHasUsers",
    method: "get",
    params: params
  });
}

//获取词典列表数据
export function dictTypeList(params) {
  return request({
    url: "/admin/dictType/list",
    method: "get",
    params: params
  });
}

//获取词典类型详情
export function dictTypeDetail(params) {
  return request({
    url: "/admin/dictType/" + params.id,
    method: "get",
    params: params
  });
}

//新增或更新词典类型
export function saveOrUpdateDictType(params) {
  return request({
    url: "/admin/dictType/saveOrUpdate",
    method: "post",
    data: qs.stringify(params)
  });
}

//启用/停用词典类型
export function changeDictTypeStatus(params) {
  return request({
    url: "/admin/dictType/changeStatus",
    method: "post",
    data: qs.stringify(params)
  });
}

//删除词典类型
export function deleteDictType(params) {
  return request({
    url: "/admin/dictType/delete",
    method: "post",
    data: qs.stringify(params)
  });
}

//获取词典数据
export function dictDataList(params) {
  return request({
    url: "/admin/dictData/list",
    method: "get",
    params: params
  });
}

//新增或更新词典数据
export function saveOrUpdateDictData(params) {
  return request({
    url: "/admin/dictData/saveOrUpdate",
    method: "post",
    data: qs.stringify(params)
  });
}

//启用/停用词典数据
export function changeDictDataStatus(params) {
  return request({
    url: "/admin/dictData/changeStatus",
    method: "post",
    data: qs.stringify(params)
  });
}

//删除词典数据
export function deleteDictData(params) {
  return request({
    url: "/admin/dictData/delete",
    method: "post",
    data: qs.stringify(params)
  });
}

//获取子字典
export function childrenDict(params) {
  return request({
    url: "/admin/dictData/childrenDict",
    method: "get",
    params: params
  });
}

//获取所有字典数据
export function listAllDict(params) {
  return request({
    url: "/admin/dictData/listAll",
    method: "get",
    params: params
  });
}

//获取所有年级信息
export function listAllOffice(params) {
  return request({
    url: "/facerecognition/getOfficeList",
    method: "get",
    params: params
  });
}
//获取班级人员信息
export function listAllOfficeUser(params) {
  return request({
    url: "/facerecognition/getUsersByOfficeId",
    method: "post",
    data: qs.stringify(params)
  });
}
//获取班级人员信息
export function updateFacePhoto(params) {
  return request({
    url: "/facerecognition/updateFacePhoto",
    method: "post",
    data: qs.stringify(params)
  });
}


//获取用户人脸下发详情
export function  getUserFaceIssuedStatus(params) {
  return request({
    url : '/userDeviceSync/detail',
    method: 'get',
    params : params,
  })
}

export  function deviceSync(params) {
  return request({
    url : '/userDeviceSync/syncDevice',
    method: 'get',
    params : params,
  })
}
// 重新下发
export function rnewIssuedFace(params) {
  return request({
    url: '/pub/pcBatchSaveIssued',
    method: 'post',
    data : qs.stringify(params)
  })
}


//保存图片校验结果
export function saveFaceCheckResult(params) {
  return request({
    url: '/facerecognition/saveFaceCheckResult',
    method: 'post',
    data : qs.stringify(params)
  })
}

//保存第三方校验图片结果
export  function savePhotoCheckResult(params) {
  return request({
    url: '/facerecognition/batchSaveFaceCheckResult',
    method: 'post',
    data : qs.stringify(params)
  })
}

// 重新下发 （新接口）
export function  reissueUserDevice(params) {
  return request({
    url: '/userDeviceSync/reissueUserDevice',
    method: 'post',
    data : qs.stringify(params)
  })

}

export function  getTest(params) {
  return request({
    url : '/index/index',
    method: 'get',
    params : params,
  })
}
